package xyz.syyrjx.blog.controller.admin;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import xyz.syyrjx.blog.entity.Result;
import xyz.syyrjx.blog.service.SiteSubmitService;

import javax.annotation.Resource;

/**
 * @author 大地崩坏苍蝇兽
 * @date 2024/2/20 15:11
 * @description ...
 * @since v0.0.1
 */
@Controller
@RequestMapping("/admin")
public class SiteSubmitController {

    @Resource
    private SiteSubmitService siteSubmitService;

    @RequestMapping("/siteSubmit")
    public ModelAndView sitSubmitPage(ModelAndView mv) {
        mv.setViewName("/admin/siteSubmit");
        return mv;
    }

    @RequestMapping("/siteSubmit/submit")
    @ResponseBody
    public Result submit(String which) {
        try {
            return Result.success(siteSubmitService.submitService(which));
        }catch (Exception e) {
            return Result.fail(e.toString());
        }

    }

}
